home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / patch / WHD_TowerBabel.lha / WHD_TowerBabel / Install next >
Text File  |  2001-04-28  |  8KB  |  353 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Tower of Babel")
  5. (set #CFG_APPSLV  "TOBHD")
  6. (set #CFG_APPGUI  "Tower of Babel")
  7. (set #CFG_APPVER  "R0401.1")
  8. (set #CFG_APPCOPY "1997-2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VP1 "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VP1 "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             ; determine version from CRC
  58.             (working "Determining game version")
  59.  
  60.             (set #VT1 (getsum #VDATFILE))
  61.             (debug #VT1)
  62.  
  63.             (set #VVERINFA 0)
  64.             (if (= #VT1 68284644) (set #VVERINFA 1))
  65.         ))
  66.     ))
  67. ))
  68.  
  69. ;------------------------------------------------------------------------------------
  70. ; Make game data
  71. ;
  72. (procedure P_InstallGame (
  73.     ;
  74.     ; Set path to game data file
  75.     ;
  76.     (set #VDATFILE (tackon #VDATDIR "Disk.1"))
  77.  
  78.     ;
  79.     ; Install data files if not found or unknown versions
  80.     ;
  81.     (P_SetVersionInfo)
  82.  
  83.     (if (<= #VVERINFA 0)(
  84.         ;
  85.         ; Tell user what is happening
  86.         ;
  87.         (message
  88.             (cat
  89.                 "\n\n\nThe installer will now create the game data files\n"
  90.                 "Plese insert your game disk into drive DF0:\n\n"
  91.                 "Click 'Proceed' when ready."
  92.             )
  93.         )
  94.  
  95.         ;
  96.         ; Call the disk image
  97.         ;
  98.         (working (cat "Creating data files in '" #VDATDIR "'"))
  99.  
  100.         (set @execute-dir #VDATDIR)
  101.         (run (cat "DIC NAME=Disk.1 FD=1 LD=1"))
  102.         (set @execute-dir #VOLDEXEDIR)
  103.     ))
  104.  
  105.     ;
  106.     ; Check the main data file was created and
  107.     ; that we know this version of the game
  108.     ;
  109.     (P_SetVersionInfo)
  110.  
  111.     (if (= 0 #VVERINFA)
  112.         (abort
  113.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  114.                     "The installer does not recognise the version of the\n"
  115.                     "game that you are trying to install.\n\n"
  116.                     "Please contact the author for further information\n"
  117.             )
  118.         )
  119.     )
  120.  
  121.     (if (= -1 #VVERINFA)
  122.         (abort
  123.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  124.                     "The installer could not extract the game data files.\n\n"
  125.                     "Please contact the author for further information\n"
  126.             )
  127.         )
  128.     )
  129.  
  130.     ;
  131.     ; Install save disk installer
  132.     ;
  133.     (copyfiles
  134.         (prompt "Installing save disk installer")
  135.         (help @copyfiles-help)
  136.         (source "InstallSD")
  137.         (newname "Install Save Disks")
  138.         (dest #VDESTDIR)
  139.         (nogauge)
  140.         (optional fail force)
  141.     )
  142.     (copyfiles
  143.         (prompt "Installing save disk installer")
  144.         (help @copyfiles-help)
  145.         (source "InstallSD.inf")
  146.         (newname "Install Save Disks.info")
  147.         (dest #VDESTDIR)
  148.         (nogauge)
  149.         (optional fail force)
  150.     )
  151.     (copyfiles
  152.         (prompt "Installing save disk installer")
  153.         (help @copyfiles-help)
  154.         (source "TOBMakeSave")
  155.         (dest #VDATDIR)
  156.         (nogauge)
  157.         (optional fail force)
  158.     )
  159.  
  160.     (message "\n\nYou can install save disks containing"
  161.              "\nlevels or games you have saved using the"
  162.              "\n\n'Install Save Disks'"
  163.              "\n\nicon located in the game directory."
  164.     )
  165.  
  166.     ;
  167.     ; Clean up previous installations
  168.     ;
  169.     (working "Cleaning up previous installation")
  170.  
  171.     (set #VT1 (tackon #VDATDIR "main"))
  172.     (if (= 1 (exists #VT1)) (delete #VT1 (optional fail force)))
  173. ))
  174.  
  175. ;------------------------------------------------------------------------------------
  176. ; Install WHDLoad slave program
  177.  
  178. (procedure P_InstallSlave (
  179.     (working "Installing slave program")
  180.  
  181.     ; first clean up previous installations
  182.     (working "Cleaning up previous installation")
  183.  
  184.     (set #VT1 (tackon #VDESTDIR "WHDLoad"))
  185.     (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)))
  186.  
  187.     (set #VT1 (tackon #VDESTDIR "TOBHD.info"))
  188.     (set #VT2 (tackon #VDESTDIR "Tower_of_Babel.info"))
  189.     (if (= 1 (exists #VT2))(
  190.         (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  191.     )(
  192.         (if (= 1 (exists #VT1)) (rename #VT1 #VT2) )
  193.     ))
  194.  
  195.     (set #VT1 (tackon #VDESTDIR "Tower_of_Babel.info"))
  196.     (set #VT2 (tackon #VDESTDIR (cat #CFG_APPGUI ".info")))
  197.     (if (= 1 (exists #VT2))(
  198.         (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  199.     )(
  200.         (if (= 1 (exists #VT1)) (rename #VT1 #VT2) )
  201.     ))
  202.  
  203.     ; copy slave program
  204.     (set #VT1 "Slave")
  205.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  206.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  207.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  208.  
  209.     (copyfiles
  210.         (prompt "Copying slave program")
  211.         (help @copyfiles-help)
  212.         (source #VT1)
  213.         (newname #CFG_APPSLV)
  214.         (dest #VDESTDIR)
  215.         (nogauge)
  216.         (optional fail force)
  217.     )
  218.  
  219.     ; see if the user wants to replace their icon
  220.     (set #VT1 (cat #CFG_APPGUI ".info"))
  221.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  222.         ; no icon exists, quietly copy one in
  223.         (set #VT2 1)
  224.     )(
  225.         ; icon exists, ask user if they want to overwrite it
  226.         (set #VT2
  227.             (askbool
  228.                 (prompt (cat "Do you want to replace the '" #CFG_APPGUI "' program icon (recommended) ?"))
  229.                 (default 1)
  230.                 (help @askchoice-help)
  231.             )
  232.         )
  233.     ))
  234.  
  235.     ; do we have a slave icon?
  236.     (if (= 1 (exists "Slave.inf"))(
  237.         ; copy slave icon, renaming to proper name along the way
  238.         (if (= 1 #VT2)(
  239.             (copyfiles
  240.                 (prompt "Copying slave program icon")
  241.                 (help @copyfiles-help)
  242.                 (source "Slave.inf")
  243.                 (newname #VT1)
  244.                 (dest #VDESTDIR)
  245.                 (nogauge)
  246.                 (optional nofail force)
  247.             )
  248.         ))
  249.     )(
  250.         ; no slave icon so we must have a GUI to install
  251.         (copyfiles
  252.             (prompt "Copying GUI program")
  253.             (help @copyfiles-help)
  254.             (source  "GUI")
  255.             (newname #CFG_APPGUI)
  256.             (dest #VDESTDIR)
  257.             (nogauge)
  258.             (optional fail force)
  259.         )
  260.  
  261.         (if (= 1 #VT2)(
  262.             (copyfiles
  263.                 (prompt "Copying GUI program icon")
  264.                 (help @copyfiles-help)
  265.                 (source  "GUI.inf")
  266.                 (newname #VT1)
  267.                 (dest #VDESTDIR)
  268.                 (nogauge)
  269.                 (optional nofail force)
  270.             )
  271.         ))
  272.     ))
  273. ))
  274.  
  275. ;================================================================================
  276. ;
  277. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  278. ;
  279.  
  280. ;
  281. ; Initialise
  282. ;
  283. (set @app-name #CFG_APPNAME)
  284. (set #VOLDEXEDIR @execute-dir)
  285. (set #VVERINFA -1)
  286. (set #VVERINFB -1)
  287. (set #VVERINFC -1)
  288. (set #VDESTDIR @default-dest)
  289.  
  290. ;
  291. ; Check settings
  292. ;
  293. (if    (<> @user-level 2)
  294.     (abort "You must select 'Expert' user level")
  295. )
  296.  
  297. (if    (< @installer-version 2818051)
  298.     (abort "This product requires at least version 43.3 of the Installer program")
  299. )
  300.  
  301. ;
  302. ; Check required programs are available
  303. ;
  304. (set #VP1 "DIC")
  305. (P_CheckRun)
  306.  
  307. ;
  308. ; Welcome message
  309. ;
  310. (message "\n\nWelcome to the " #CFG_APPNAME " HD Installer"
  311.          "\n© " #CFG_APPCOPY " John Girvin/Halibut Software\n\n"
  312.          "Please read the documentation thoroughly "
  313.          "before attempting to use this installer!\n\n"
  314.          "This is release " #CFG_APPVER "\n\n"
  315.          "Click 'Proceed' to begin..."
  316. )
  317.  
  318. ;
  319. ; Get directory to install in
  320. ;
  321. (set #VDESTDIR
  322.     (askdir
  323.         (prompt "Where would you like the game installed?\n"
  324.                 "If you have an existing installation select that directory,\n"
  325.                 "otherwise create / select the directory to install the game into."
  326.         )
  327.         (help @askdir-help)
  328.         (default @default-dest)
  329.         (disk)
  330.         (newpath)
  331.     )
  332. )
  333. (set #VDESTDIR (expandpath #VDESTDIR))
  334. (set @default-dest #VDESTDIR)
  335. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  336.  
  337. ;
  338. ; Create the installation directories
  339. ;
  340. (P_InstallDirs)
  341.  
  342. ;
  343. ; Install the game data
  344. ;
  345. (P_InstallGame)
  346.  
  347. ;
  348. ; Install the slave
  349. ;
  350. (P_InstallSlave)
  351.  
  352. ;=======================================================================================
  353. ;$VER: Tower of Babel Installer script R0401.1 © 1997-2001 John Girvin/Halibut Software